'use strict'
const uniPush = uniCloud.getPushManager({ appId: '__UNI__90AEC91' })
const TOKEN = 'hfsygl'
exports.main = async (event, context) => {
  let { token, client_id, title, content, data } = event['queryStringParameters']
  if (token != TOKEN) {
    return { 'errCode': -1 }
  }
  client_id = client_id.split(',')
  data = JSON.parse(data)
  return await uniPush.sendMessage({
    'push_clientid': client_id,
    'title': title,
    'content': content,
    'payload': data
  })
}